package com.example.demo.config.event.action;

import com.example.demo.utils.RedisUtil;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;

import com.example.demo.app.entity.FormEntity;
import com.example.demo.config.enum_.ComplexFormEvents;
import com.example.demo.config.enum_.ComplexFormStates;

/**
 * 复杂表单,验证失败后的处理
 * @author hello
 *
 */
public class ComplexForm_DEAL_CHOICE_false_Action implements Action<ComplexFormStates, ComplexFormEvents> {

	@Override
	public void execute(StateContext<ComplexFormStates, ComplexFormEvents> context) {
		FormEntity form = context.getMessage().getHeaders().get("form", FormEntity.class);
			form.setMsg("这是一个废单 ， 会被撕掉 。");
		RedisUtil.set(form.getId(),form);
		System.out.println("这是一个废单 ， 会被撕掉 =====>" +form);
		System.out.println(context.getStateMachine().getState());
	}
	
}
